import request from '@/utils/request'

export function fetchList(query) {
    return request({
        url: '/stock/api/alarmRecord/query/page',
        method: 'get',
        params: query
    })
}
//查询所有关联设备详情列表，
export function fetchDetailList(id) {
    return request({
        url: `/device/api/deviceProduct/query/asset/page/${id}`,
        method: 'get',
        //params: query
    })
}
//查询历史档案信息
export function fetchHistoryList(id) {
    return request({
        url: `/device/api/productArchive/query/list/${id}`,
        method: 'get',
        //params: query
    })
}
//查询入库
export function fetchInStockList(productId) {
    return request({
        url: `/stock/api/stockRecord//query/page/in/${productId}`,
        method: 'get',
        //params: query
    })
}
//查询出库
export function fetchOutStockList(productId) {
    return request({
        url: `/stock/api/stockRecord//query/page/out/${productId}`,
        method: 'get',
        //params: query
    })
}
//保存设备信息
export function saveDeviceInfo(query) {
    if (query.id) {
        return request({
            url: '/device/api/deviceProduct',
            method: 'put',
            data: query
        })
    } else {
        return request({
            url: '/device/api/deviceProduct',
            method: 'post',
            data: query
        })
    }

}
//设备详细信息
export function fetchDetailInfo(query) {
    return request({
        url: '/device/api/deviceProduct/query/' + query,
        method: 'get',
    })
}
//批量导入
export function importFile(params) {
    return request({
        url: '/device/api/deviceProduct/import',
        method: 'get',
    })
}
//下载批量导入模板

export function downloadTemplete(query) {
    return request({
        url: '/device/api/deviceProduct/download/template',
        method: 'get',
        params: query
    })
}
//删除台账
export function deleteDeviceInfo(query) {
    return request({
        url: '/stock/api/alarmRecord/batch',
        method: 'delete',
        data: [query]
    })
}